var t = getApp(), e = t.requirejs("core");

t.requirejs("foxui");

Page({
    data: {
      icons: t.requirejs("icons"),
      page: 1,
      loading: false,
      loaded: false,
      type: 2,
      list: [],
    },
    onLoad: function(e) {  },
    onShow: function() {
        this.setData({
            imgUrl: t.globalData.approot
        }),
        this.getList();
    },
    getList: function() {
        var t = this, type = t.data.type;
        t.setData({
            loading: true
        }), e.get("member/merchcard/get_list", {
            type: type,
            page: t.data.page,
        }, function(e) {
            var i = {
                loading: false,
                total: e.total,
                pagesize: e.pagesize,
                show: !0
            };
            e.list.length > 0 && (i.page = t.data.page + 1, i.list = t.data.list.concat(e.list), 
            e.list.length < e.pagesize && (i.loaded = true)), t.setData(i);
        });
    },
    url: function(p) {
        var url = "", userinfoOpenid = t.getCache("userinfo_openid");
        if(userinfoOpenid) url = p.currentTarget.dataset.url;
        else url = "/pages/auth/index"
        wx.navigateTo({ url: url, })
      },
    onReachBottom: function() {
        this.data.loaded || this.data.list.length == this.data.total || this.getList();
    },
    onPullDownRefresh: function() {
        wx.stopPullDownRefresh();
    },
});